const { injectBabelPlugin } = require('react-app-rewired');
const rewireLess = require('react-app-rewire-less');
const configJOSN = require("./src/config.json");

module.exports = function override(config, env) {
  config = injectBabelPlugin(
    ['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }], // change importing css to less
    config,
  );
  delete configJOSN.host;
  delete configJOSN.logo;
  delete configJOSN["@icon-url"];
  config = rewireLess.withLoaderOptions({
    modifyVars: configJOSN,
    javascriptEnabled: true,
  })(config, env);
  return config;
};